/**
 date: 2018-4-21 15:14:33
 auther: fky
 */
import {Injectable} from '@angular/core';
import {UserModel} from '../models/user.model';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs/Observable';

@Injectable()
export class UsersService {

  constructor(private httpclient: HttpClient) {
  }

  getUserDetial(id: number): Observable<UserModel> {
    return this.httpclient.get('/api/user/' + id).map(response => {
      return new UserModel(response);
    });
  }

  getUserList(): Observable<any> {
    return this.httpclient.get('/api/user/list');
  }


  removeUserById(id: number): Observable<any> {
    return this.httpclient.delete('/api/user/' + id);
  }

  getRoles(): Observable<any> {
    return this.httpclient.get('/api/userrole/');
  }


}
